﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using Antu.WebControls;
using Antu.Core.Components;
using Antu.Core.Services;
using System.Web.UI.WebControls;
using EluZSProvider;
using System.Web;
using System.Data;

namespace WebSys.UI.Control.ZhengShou
{
    public class ZS_BCJDLRInfoControl : MPBasicTemplate
    {
        EluZSDataProvider _EluZSDataProvider = (EluZSDataProvider)ProviderService.ProviderServiceMange.GetProvider("EluZSProvider");
        
        MPCalendar calZjTime;
        Button btnSaveZjTime;
        CustomGridView gridviewxzfy, gridviewYsss, gridviewEsss, gridviewZsss, gridviewKs, gridviewQcxx,gridviewSfsq,
            CustomGridView1, CustomGridView2, CustomGridView3, CustomGridView4, CustomGridView5, CustomGridView6, CustomGridView7;
        Label labSQR;
        Label labBSQR;
        Label labSLSJ;//受理时间
        Label labJAQK;//结案情况
        public static String CaseID = string.Empty;
        public static String idadmin = string.Empty;
        public static String nCount = "1";
        public static String xHtmlString = string.Empty;
        public string userid = string.Empty;


        protected override void OnLoad(EventArgs e)
        {
            if (HttpContext.Current.Session["UserID"] == null)
            {
                Antu.Utilities.UtilitiesPage.AlertDialogClear("登录超时，请重新登录！", "window.parent.location.href('../login.aspx');");
            }
            else
            {
                userid = HttpContext.Current.Session["UserID"].ToString();
            }
            base.OnLoad(e);
            InitControl();
            xHtmlString = string.Empty;
            idadmin = base.Page.Request["id"];
            string strIId = base.Page.Request["IID"];
            string rCaseid = base.Page.Request["caseid"];
            if (idadmin == "" || idadmin == null)
            {
                idadmin = _EluZSDataProvider.GetSomeStr("ZS_CASE_REGISTER", "id", "caseid", "caseid");
            }
            if (!string.IsNullOrEmpty(strIId))
            {
                if (string.IsNullOrEmpty(idadmin))
                {
                    string sql = "select id from zs_case_register where iid='" + strIId + "'";
                    idadmin = _EluZSDataProvider.GetSomeWhere("(" + sql + ")", "*", " 1=1 ");
                }
                Label labQWSX = (Label)FindControl("labQWSX");
                Label labCASEID = (Label)FindControl("labCASEID");
                labQWSX.Visible = false;
                //labCASEID.Text = strIId;

                Bind2(strIId);
                Bind3(strIId);
                base.Page.ClientScript.RegisterStartupScript(this.GetType(), "disttable", "<script>disttable();</script>");

            }
            CaseID = GetCaseID();
            if (string.IsNullOrEmpty(CaseID))
            {
                CaseID = rCaseid;
            }
            if (!base.Page.IsPostBack)
            {
                DatabinderMain();
            }
            if (base.Page.Session["nCount"] != null && base.Page.Session["nCount"].ToString() != "")
            {
                nCount = base.Page.Session["nCount"].ToString();
            }
            btnSaveZjTime.Click+=new EventHandler(btnSaveZjTime_Click);
            Button btnUpload = (Button)FindControl("Button30");
            btnUpload.Click += new EventHandler(btnUpload_Click);
            if (!base.Page.IsPostBack) {
                string strID = base.Page.Request["ID"];
                if (_EluZSDataProvider.CkFileCount(strID, "16")) { _EluZSDataProvider.UpdateFileCS(strID, "16"); }
            }
            IsLookPerson();
        }


        private void IsLookPerson()
        {
            string sql = "Select rolename from zs_role where id in (Select roleid from zs_user_in_role where userid = '" + userid + "')";
            DataTable dt = _EluZSDataProvider.GetTable(sql);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["rolename"].ToString().Equals("查看人员"))
                    {
                        Button Button27 = (Button)FindControl("Button27");
                        Button27.Visible = false;
                        Button btnAdd = (Button)FindControl("btnAdd");
                        btnAdd.Visible = false;
                        Button Button2 = (Button)FindControl("Button2");
                        Button2.Visible = false;
                        Button Button9 = (Button)FindControl("Button9");
                        Button9.Visible = false;
                        Button Button7 = (Button)FindControl("Button7");
                        Button7.Visible = false;
                        Button Button32 = (Button)FindControl("Button32");
                        Button32.Visible = false;
                        Button Button35 = (Button)FindControl("Button35");
                        Button35.Visible = false;

                    }
                }
            }
        }


        void Bind2(string strPJID)
        {

            string psql = @"select  (select keyvalue from zs_params where name='区属' and keyname =
(select 区属 from zs_project where id in (select pid from zs_prono where id=t.pid))) 区属,
(select 征收许可证号 from zs_prono where id=t.pid) 征收决定号
 from zs_zzbcjfenhu t where id=
(select 关联ID from xt_instance_ext where iid='" + strPJID + "')";
            DataTable dt1 = _EluZSDataProvider.GetOneDs("(" + psql + ")", "*", "").Tables[0];
            if (dt1.Rows.Count > 0)
            {
                Label labXKZH = (Label)FindControl("labXKZH");
                labXKZH.Text = dt1.Rows[0]["征收决定号"].ToString();
                Label labSZQ = (Label)FindControl("labSZQ");
                //labSZQ.Text = dt1.Rows[0]["区属"].ToString();
                string ss = @"select keyname from zs_params where keyvalue='" + dt1.Rows[0]["区属"].ToString() + "' and name ='区属'";
                DataTable able = _EluZSDataProvider.GetOneDs("(" + ss + ")", "*", "").Tables[0];
                if (able.Rows.Count > 0)
                {
                    labSZQ.Text = able.Rows[0]["keyname"].ToString();
                }
            }


            string sql = @"select * from zs_zsperson where id = 
( select ZSPID from zs_zzbcjfenhu where id= 
(select 关联ID from xt_instance_ext where iid='" + strPJID + "'))";
            DataTable dt = _EluZSDataProvider.GetOneDs("(" + sql + ")", "*", "").Tables[0];
            if (dt.Rows.Count > 0)
            {
                Label labFWDZ = (Label)FindControl("labFWDZ");//被收购房屋地址
                Label labJZMJ = (Label)FindControl("labJZMJ");//建筑面积
                labFWDZ.Text=dt.Rows[0]["房屋坐落"].ToString();
                labJZMJ.Text = dt.Rows[0]["房屋建筑面积"].ToString();
            }


            string sql3 = @"select * from zs_zzbcjfenhu where id=
(select 关联ID from xt_instance_ext where iid='" + strPJID + "')";
            DataTable dt3 = _EluZSDataProvider.GetOneDs("(" + sql3 + ")", "*", "").Tables[0];
            if (dt3.Rows.Count > 0)
            {
                double temp1 = 0, temp2 = 0, temp3 = 0, temp4 = 0;

                if (!string.IsNullOrEmpty(dt3.Rows[0]["ZZ评估总价"].ToString()))
                {
                    temp1 = Convert.ToDouble(dt3.Rows[0]["ZZ评估总价"].ToString().Trim());
                }
                if (!string.IsNullOrEmpty(dt3.Rows[0]["YY评估总价"].ToString()))
                {
                    temp2 = Convert.ToDouble(dt3.Rows[0]["YY评估总价"].ToString().Trim());
                }
                if (!string.IsNullOrEmpty(dt3.Rows[0]["FYY评估总价"].ToString()))
                {
                    temp3 = Convert.ToDouble(dt3.Rows[0]["FYY评估总价"].ToString().Trim());
                }
                if (!string.IsNullOrEmpty(dt3.Rows[0]["ZS室内装饰装修评估补偿金额合计"].ToString()))
                {
                    temp4 = Convert.ToDouble(dt3.Rows[0]["ZS室内装饰装修评估补偿金额合计"].ToString().Trim());
                }
                Label labPGJE = (Label)FindControl("labPGJE");
                labPGJE.Text = (temp1 + temp2 + temp3 + temp4).ToString();
            }
        }


        void Bind3(string strPJID)
        {
            string sql = @"select * from zs_project where id=(
select pid from zs_prono where id =(select PID from zs_zzbcjfenhu where id= 
 (select 关联ID from xt_instance_ext  where iid='" + strPJID + "')))";//得到征收人
            DataTable dt = _EluZSDataProvider.GetOneDs("(" + sql + ")", "*", "").Tables[0];
            if (dt.Rows.Count > 0)
            {
                labSQR.Text = dt.Rows[0]["征收实施单位"].ToString();
            }
            string sql2 = @"select * from zs_zsperson where id = 
( select ZSPID from zs_zzbcjfenhu where id= 
(select 关联ID from xt_instance_ext where iid='" + strPJID + "'))";
            DataTable dt2 = _EluZSDataProvider.GetOneDs("(" + sql2 + ")", "*", "").Tables[0];
            if (dt2.Rows.Count > 0)
            {
                labBSQR.Text = dt2.Rows[0]["产权人"].ToString();
            }

        }

        protected void InitControl() {
            btnSaveZjTime = (Button)FindControl("btnSaveZjTime");
            calZjTime = (MPCalendar)FindControl("calZjTime");
            gridviewxzfy = (CustomGridView)FindControl("gridviewxzfy");
            gridviewYsss = (CustomGridView)FindControl("gridviewYsss");
            gridviewEsss = (CustomGridView)FindControl("gridviewEsss");

            gridviewZsss = (CustomGridView)FindControl("gridviewZsss");
            gridviewKs = (CustomGridView)FindControl("gridviewKs");
            gridviewQcxx = (CustomGridView)FindControl("gridviewQcxx");
            gridviewSfsq = (CustomGridView)FindControl("gridviewSfsq");

            CustomGridView1 = (CustomGridView)FindControl("CustomGridView1");
            CustomGridView2 = (CustomGridView)FindControl("CustomGridView2");
            CustomGridView3 = (CustomGridView)FindControl("CustomGridView3");
            CustomGridView4 = (CustomGridView)FindControl("CustomGridView4");
            CustomGridView5 = (CustomGridView)FindControl("CustomGridView5");
            CustomGridView6 = (CustomGridView)FindControl("CustomGridView6");
            CustomGridView7 = (CustomGridView)FindControl("CustomGridView7");

            labSQR = (Label)FindControl("labSQR");
            labBSQR = (Label)FindControl("labBSQR");
            labSLSJ = (Label)FindControl("labSLSJ");
            labSLSJ.Text = DateTime.Now.ToShortDateString();
            labJAQK = (Label)FindControl("labJAQK");//结案情况
            labJAQK.Text = "正在审理";
            
        }
        protected void DatabinderMain()
        {
            gridviewxzfy.RowCreated += new GridViewRowEventHandler(gridviewxzfy_RowCreated);
            gridviewYsss.RowCreated += new GridViewRowEventHandler(gridviewYsss_RowCreated);
            gridviewEsss.RowCreated += new GridViewRowEventHandler(gridviewEsss_RowCreated);
            gridviewZsss.RowCreated += new GridViewRowEventHandler(gridviewZsss_RowCreated);
            gridviewKs.RowCreated += new GridViewRowEventHandler(gridviewKs_RowCreated);
            gridviewQcxx.RowCreated += new GridViewRowEventHandler(gridviewQcxx_RowCreated);
            gridviewSfsq.RowCreated += new GridViewRowEventHandler(gridviewSfsq_RowCreated);
            if (!string.IsNullOrEmpty(idadmin))
            {
                DataBinder(idadmin);
                databindCqxzfy();
                databindCqysss();
                databindCqesss();
                databindCqzsss();
                databindCqKsxx();
                databindCqqcxx();
                databindSfsq();
            }
        }

        #region 页面数据绑定
        protected void DataBinder(string id)
        {
            DataTable dt = new DataTable();
            string whereKey = " and id= '" + id + "'";
            if (!string.IsNullOrEmpty(whereKey))
            {
                dt = GetCqcjInfo(whereKey);
            }
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataColumn cl in dt.Columns)
                {
                    if (dt.Rows[0]["JZSJ"].ToString() != "" && dt.Rows[0]["JZSJ"] != null)
                    {
                        calZjTime.Text = string.Format("{0:d}", dt.Rows[0]["JZSJ"]);
                    }
                    string tt = "lab" + cl.ColumnName.ToLower().Trim();
                    Label lb = (Label)FindControl(tt);
                    //Label lb = base.Page.FindControl("lab" + cl.ColumnName.ToLower().Trim()) as Label;
                    if (lb != null)
                    {
                        switch (cl.ToString())
                        {
                            case "TZSJ":
                            case "CJSJ":
                            case "REFERTWOTIME":
                            case "REFERONETIME":
                            case "SLSJ":
                            case "SERVICEONETIME":
                            case "TINGZHENGDATE":
                            case "QIANGZHIDATE":
                            case "CUIGAOSONGDADATE":
                            case "CUIGAOFACHUDATE":
                            case "CAIJUESONGDADATE":
                            case "XYQIANGZHIDATE":
                            case "XYTINGZHENGDATE":
                            case "CAIJUEXIADADATE":
                                if (lb.Text != null)
                                {
                                    lb.Text = string.Format("{0:d}", dt.Rows[0][cl]);
                                }
                                break;
                            case "SZQ":
                                lb.Text = returnKeyValue("区属", dt.Rows[0][cl].ToString());
                                break;
                            case "JAQK":
                                lb.Text = returnKeyValue("结案情况", dt.Rows[0][cl].ToString());
                                break;
                            case "FYSLJG":
                                lb.Text = returnKeyValue("裁定结果", dt.Rows[0][cl].ToString());
                                break;
                            case "XYFYSLJG":
                                lb.Text = returnKeyValue("裁定结果", dt.Rows[0][cl].ToString());
                                break;
                            case "XYFYZXQK":
                                lb.Text = returnKeyValue("执行情况", dt.Rows[0][cl].ToString());
                                break;
                            case "FYZXQK":
                                lb.Text = returnKeyValue("执行情况", dt.Rows[0][cl].ToString());
                                break;
                            case "PGJE":
                                lb.Text = string.Format("{0:N}", dt.Rows[0][cl]);
                                break;
                            default:
                                lb.Text = dt.Rows[0][cl].ToString();
                                break;
                        }
                    }
                }
            }
        }
        #endregion

        #region 产权房屋Html
        protected void CqfwHtml(DataTable dt)
        {
            System.Text.StringBuilder sb_Content = new System.Text.StringBuilder();
            string s = string.Empty;
            if (dt.Rows.Count > 0)
            {
                string strHead = @"<br/><table border='1'  cellpadding='0' cellspacing='0' width='95%' class='window_tab_list'>
                <tr><th colspan='5'>产权房屋查询</th></tr>
                <tr>
                <td>建筑面积(平方米)</td><td>单价(元/平方米)</td><td> 产权房屋调换地址</td><td> 总价(元)</td><td>补偿差价(元)</td>
                </tr>
                ";
                string strEnd = "</table>";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sb_Content.Append("<tr style='height:25px;'>");
                    foreach (DataColumn cl in dt.Columns)
                    {
                        switch (cl.ToString())
                        {
                            case "JZMJ":
                            case "DJ":
                            case "CQFWDHDZ":
                            case "ZJ":
                            case "BCCJ":
                                sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", dt.Rows[i][cl].ToString());
                                break;
                            default:
                                break;
                        }
                    }
                }
                s = string.Format("{0}{1}{2}", strHead, sb_Content.ToString(), strEnd);
            }
            if(!xHtmlString.Contains(s)){ xHtmlString += s; }
        }
        #endregion

        #region 房屋拆迁裁决审批表Html
        /// <summary>
        /// 房屋拆迁裁决审批表Html
        /// </summary>
        /// <param name="dt"></param>
        protected void CqcjspHtml(DataTable dt)
        {
            System.Text.StringBuilder sb_Content = new System.Text.StringBuilder();
            string s = string.Empty;
            if (dt.Rows.Count > 0)
            {
                string strHead = @"<br/><table border='1'  cellpadding='0' cellspacing='0' width='95%' class='window_tab_list'>
                <tr><th colspan='5'>房屋拆迁裁决审批表</th></tr>
                <tr>
                <td>案件号</td><td>案件摘要</td><td> 经办人</td><td>  负责人</td><td> 审核状态</td>
                </tr>
                ";
                string strEnd = "</table>";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sb_Content.Append("<tr style='height:25px;'>");
                    foreach (DataColumn cl in dt.Columns)
                    {
                        switch (cl.ToString())
                        {
                            case "CASEID":
                            case "AJZY":
                            case "JBR":
                            case "FZR":
                            case "sShzt":
                                sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", dt.Rows[i][cl].ToString());
                                break;
                            default:
                                break;
                        }
                    }
                }
                s = string.Format("{0}{1}{2}", strHead, sb_Content.ToString(), strEnd);
            }
            if (!xHtmlString.Contains(s)) { xHtmlString += s; }
        }
        #endregion

        #region 行政复议Html
        /// <summary>
        /// 行政复议Html
        /// </summary>
        /// <param name="dt"></param>
        protected void CqxmfyHtml(DataTable dt)
        {
            System.Text.StringBuilder sb_Content = new System.Text.StringBuilder();
            string s = string.Empty;
            if (dt.Rows.Count > 0)
            {
                string strHead = @"<br/><table border='1'  cellpadding='0' cellspacing='0' width='95%' class='window_tab_list'>
                <tr><th colspan='6'>行政复议查询</th></tr>
                <tr><td>案件号</td>
                <td>复议号</td><td>申请人</td><td>答复人</td><td>判决日期</td><td>复议状态</td>
                </tr>
                ";
                string strEnd = "</table>";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sb_Content.Append("<tr style='height:25px;'>");
                    foreach (DataColumn cl in dt.Columns)
                    {
                        switch (cl.ToString())
                        {
                            case "FYH":
                            case "SQR":
                            case "CASEID":
                            case "DFR":
                            case "SFY":
                                sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", dt.Rows[i][cl].ToString());
                                break;
                            case "PJRQ":
                                if (dt.Rows[i][cl].ToString() != "")
                                {
                                    sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", String.Format("{0:d}", dt.Rows[i][cl]));
                                }
                                else
                                {
                                    sb_Content.AppendFormat("<td>&nbsp;</td>");
                                }
                                break;
                            default:
                                break;
                        }
                    }
                }
                s = string.Format("{0}{1}{2}", strHead, sb_Content.ToString(), strEnd);
                if (!xHtmlString.Contains(s)) { xHtmlString += s; }
            }
            else {
                xHtmlString +="";
            }
            //if (!xHtmlString.Contains(s)) { xHtmlString += s; }
        }
        #endregion

        #region 行政复议
        /// <summary>
        /// 行政复议
        /// </summary>
        protected void databindCqxzfy()
        {
            DataTable dt = new DataTable();
            string caseid = GetCaseID();
            string whereKey = " and caseid = '" + caseid + "'";
            dt = GetCjxzfy(whereKey);
            if (dt.Rows.Count > 0)
            {
                DataColumn dc = new DataColumn("SFY");
                dt.Columns.Add(dc);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string sFyzt = dt.Rows[i]["sFyzt"].ToString();
                    dt.Rows[i]["SFY"] = sFyzt;
                }
            }
            gridviewxzfy.DataSource = dt;
            gridviewxzfy.RecordCount = dt.Rows.Count;
            gridviewxzfy.DataBind();
            CqxmfyHtml(dt);
            CustomGridView1.DataSource = dt;
            CustomGridView1.RecordCount = dt.Rows.Count;
            CustomGridView1.DataBind();
            CustomGridView1.EmptyDataText = string.Empty;
        }
        #endregion

        #region 一审诉讼信息查询Html
        /// <summary>
        /// 一审诉讼信息查询Html
        /// </summary>
        /// <param name="dt"></param>
        protected void CqysssHtml(DataTable dt)
        {
            System.Text.StringBuilder sb_Content = new System.Text.StringBuilder();
            string s = string.Empty;
            if (dt.Rows.Count > 0)
            {
                string strHead = @"<br/><table border='1'  cellpadding='0' cellspacing='0' width='95%' class='window_tab_list'>
                <tr><th colspan='8'>一审诉讼信息查询</th></tr>
                <tr>
                <td style='width:20%'> 诉讼号</td><td style='width:10%'>原告</td><td style='width:8%'>被告</td>
<td style='width:13%'>第三人</td>
<td style='width:10%'>传票到达日期</td>
<td style='width:10%'>开庭日期</td>
<td style='width:10%'>判决日期</td>
<td style='width:8%'> 诉讼状态</td>
                </tr>
                ";
                string strEnd = "</table>";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sb_Content.Append("<tr style='height:25px;'>");
                    foreach (DataColumn cl in dt.Columns)
                    {
                        switch (cl.ToString())
                        {
                            case "SSH":
                            case "YG":
                            case "BG":
                            case "DSR":
                            case "sSszt":
                                sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", dt.Rows[i][cl].ToString());
                                break;
                            case "CPDDSJ":
                            case "KTSJ":
                            case "PJSJ":
                                if (dt.Rows[i][cl].ToString() != "")
                                {
                                    sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", String.Format("{0:d}", dt.Rows[i][cl]));
                                }
                                else
                                {
                                    sb_Content.AppendFormat("<td>&nbsp;</td>");
                                }
                                break;
                            default:
                                break;

                        }
                    }
                }
                s = string.Format("{0}{1}{2}", strHead, sb_Content.ToString(), strEnd);
                if (!xHtmlString.Contains(s)) { xHtmlString += s; }
            }
            else
            {
                xHtmlString += "";
            }
            //if (!xHtmlString.Contains(s)) { xHtmlString += s; }
        }
        #endregion

        #region 一审诉讼信息查询
        /// <summary>
        /// 一审诉讼信息查询
        /// </summary>
        protected void databindCqysss()
        {
            DataTable dt = new DataTable();
            string caseid = GetCaseID();
            string whereKey = " and caseid = '" + caseid + "'";
            dt = GetCqcjOneJustice(whereKey);
            if (dt.Rows.Count > 0)
            {
                DataColumn dc = new DataColumn("sSszt");
                dt.Columns.Add(dc);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string sSszt = returnKeyValue("诉讼状态", dt.Rows[i]["sszt"].ToString());
                    dt.Rows[i]["sSszt"] = sSszt;
                }
            }
            gridviewYsss.DataSource = dt;
            gridviewYsss.RecordCount = dt.Rows.Count;
            gridviewYsss.DataBind();
            CqysssHtml(dt);
            CustomGridView2.DataSource = dt;
            CustomGridView2.RecordCount = dt.Rows.Count;
            CustomGridView2.DataBind();
        }
        #endregion

        #region 二审诉讼信息查询Html
        /// <summary>
        /// 二审诉讼信息查询Html
        /// </summary>
        /// <param name="dt"></param>
        protected void CqesssHtml(DataTable dt)
        {
            System.Text.StringBuilder sb_Content = new System.Text.StringBuilder();
            string s = string.Empty;
            if (dt.Rows.Count > 0)
            {
                string strHead = @"<br/><table border='1'  cellpadding='0' cellspacing='0' width='95%' class='window_tab_list'>
                <tr><th colspan='8'>二审诉讼信息查询</th></tr>
                <tr>
                <td style='width:20%'> 诉讼号</td><td style='width:10%'>原告</td><td style='width:8%'>被告</td>
<td style='width:13%'>第三人</td>
<td style='width:10%'>传票到达日期</td>
<td style='width:10%'>开庭日期</td>
<td style='width:10%'>判决日期</td>
<td style='width:8%'> 诉讼状态</td>
                </tr>
                ";
                string strEnd = "</table>";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sb_Content.Append("<tr style='height:25px;'>");
                    foreach (DataColumn cl in dt.Columns)
                    {
                        switch (cl.ToString())
                        {
                            case "SSH":
                            case "YG":
                            case "BG":
                            case "DSR":
                            case "sSszt":
                                sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", dt.Rows[i][cl].ToString());
                                break;
                            case "CPDDSJ":
                            case "KTSJ":
                            case "PJSJ":
                                if (dt.Rows[i][cl].ToString() != "")
                                {
                                    sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", String.Format("{0:d}", dt.Rows[i][cl]));
                                }
                                else
                                {
                                    sb_Content.AppendFormat("<td>&nbsp;</td>");
                                }
                                break;
                            default:
                                break;

                        }
                    }
                }
                s = string.Format("{0}{1}{2}", strHead, sb_Content.ToString(), strEnd);
                if (!xHtmlString.Contains(s)) { xHtmlString += s; }
            }
            else
            {
                xHtmlString += "";
            }
            //if (!xHtmlString.Contains(s)) { xHtmlString += s; }
        }
        #endregion

        #region 二审诉讼信息查询
        /// <summary>
        /// 二审诉讼信息查询
        /// </summary>
        protected void databindCqesss()
        {
            DataTable dt = new DataTable();
            string caseid = GetCaseID();
            string whereKey = " and caseid = '" + caseid + "'";
            dt = GetCqcjTwoJustice(whereKey);
            if (dt.Rows.Count > 0)
            {
                DataColumn dc = new DataColumn("sSszt");
                dt.Columns.Add(dc);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string sSszt = returnKeyValue("诉讼状态", dt.Rows[i]["sszt"].ToString());
                    dt.Rows[i]["sSszt"] = sSszt;
                }
            }
            gridviewEsss.DataSource = dt;
            gridviewEsss.RecordCount = dt.Rows.Count;
            gridviewEsss.DataBind();
            CqesssHtml(dt);
            CustomGridView3.DataSource = dt;
            CustomGridView3.RecordCount = dt.Rows.Count;
            CustomGridView3.DataBind();
        }
        #endregion

        #region 再审诉讼信息查询Html
        /// <summary>
        /// 再审诉讼信息查询Html
        /// </summary>
        /// <param name="dt"></param>
        protected void CqZsssHtml(DataTable dt)
        {
            System.Text.StringBuilder sb_Content = new System.Text.StringBuilder();
            string s = string.Empty;
            if (dt.Rows.Count > 0)
            {
                string strHead = @"<br/><table border='1'  cellpadding='0' cellspacing='0' width='95%' class='window_tab_list'>
                <tr><th colspan='8'>再审诉讼信息查询</th></tr>
                <tr>
                <td style='width:20%'> 诉讼号</td><td style='width:10%'>原告</td><td style='width:8%'>被告</td>
<td style='width:13%'>第三人</td>
<td style='width:10%'>传票到达日期</td>
<td style='width:10%'>开庭日期</td>
<td style='width:10%'>判决日期</td>
<td style='width:8%'> 诉讼状态</td>
                </tr>
                ";
                string strEnd = "</table>";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sb_Content.Append("<tr style='height:25px;'>");
                    foreach (DataColumn cl in dt.Columns)
                    {
                        switch (cl.ToString())
                        {
                            case "SSH":
                            case "YG":
                            case "BG":
                            case "DSR":
                            case "sSszt":
                                sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", dt.Rows[i][cl].ToString());
                                break;
                            case "CPDDSJ":
                            case "KTSJ":
                            case "PJSJ":
                                if (dt.Rows[i][cl].ToString() != "")
                                {
                                    sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", String.Format("{0:d}", dt.Rows[i][cl]));
                                }
                                else
                                {
                                    sb_Content.AppendFormat("<td>&nbsp;</td>");
                                }
                                break;
                            default:
                                break;

                        }
                    }
                }
                s = string.Format("{0}{1}{2}", strHead, sb_Content.ToString(), strEnd);
                if (!xHtmlString.Contains(s)) { xHtmlString += s; }
            }
            else
            {
                xHtmlString += "";
            }
            //if (!xHtmlString.Contains(s)) { xHtmlString += s; }
        }
        #endregion

        #region 再审诉讼信息查询
        /// <summary>
        /// 再审诉讼信息查询
        /// </summary>
        protected void databindCqzsss()
        {
            DataTable dt = new DataTable();
            string caseid = GetCaseID();
            string whereKey = " and caseid = '" + caseid + "'";
            dt = GetCqcjThreeJustice(whereKey);
            if (dt.Rows.Count > 0)
            {
                DataColumn dc = new DataColumn("sSszt");
                dt.Columns.Add(dc);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string sSszt = returnKeyValue("诉讼状态", dt.Rows[i]["sszt"].ToString());
                    dt.Rows[i]["sSszt"] = sSszt;
                }
            }
            gridviewZsss.DataSource = dt;
            gridviewZsss.RecordCount = dt.Rows.Count;
            gridviewZsss.DataBind();
            CqZsssHtml(dt);
            CustomGridView4.DataSource = dt;
            CustomGridView4.RecordCount = dt.Rows.Count;
            CustomGridView4.DataBind();
        }
        #endregion

        #region 抗诉信息查询
        /// <summary>
        /// 抗诉信息查询
        /// </summary>
        protected void databindCqKsxx()
        {
            DataTable dt = new DataTable();
            string caseid = GetCaseID();
            string whereKey = " and caseid = '" + caseid + "'";
            dt = GetCqcjResistJustice(whereKey);
            if (dt.Rows.Count > 0)
            {
                DataColumn dc = new DataColumn("sSszt");
                dt.Columns.Add(dc);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string sSszt = returnKeyValue("诉讼状态", dt.Rows[i]["sszt"].ToString());
                    dt.Rows[i]["sSszt"] = sSszt;
                }
            }
            gridviewKs.DataSource = dt;
            gridviewKs.RecordCount = dt.Rows.Count;
            gridviewKs.DataBind();
            CqKsxxHtml(dt);
            CustomGridView5.DataSource = dt;
            CustomGridView5.RecordCount = dt.Rows.Count;
            CustomGridView5.DataBind();
        }
        #endregion

        #region 抗诉信息查询Html
        protected void CqKsxxHtml(DataTable dt)
        {
            System.Text.StringBuilder sb_Content = new System.Text.StringBuilder();
            string s = string.Empty;
            if (dt.Rows.Count > 0)
            {
                string strHead = @"<br/><table border='1'  cellpadding='0' cellspacing='0' width='95%' class='window_tab_list'>
                <tr><th colspan='8'>抗诉信息查询</th></tr>
                <tr>
                <td style='width:20%'> 诉讼号</td><td style='width:10%'>原告</td><td style='width:8%'>被告</td>
<td style='width:13%'>第三人</td>
<td style='width:10%'>传票到达日期</td>
<td style='width:10%'>开庭日期</td>
<td style='width:10%'>判决日期</td>
<td style='width:8%'> 诉讼状态</td>
                </tr>
                ";
                string strEnd = "</table>";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sb_Content.Append("<tr style='height:25px;'>");
                    foreach (DataColumn cl in dt.Columns)
                    {
                        switch (cl.ToString())
                        {
                            case "SSH":
                            case "YG":
                            case "BG":
                            case "DSR":
                            case "sSszt":
                                sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", dt.Rows[i][cl].ToString());
                                break;
                            case "CPDDSJ":
                            case "KTSJ":
                            case "PJSJ":
                                if (dt.Rows[i][cl].ToString() != "")
                                {
                                    sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", String.Format("{0:d}", dt.Rows[i][cl]));
                                }
                                else
                                {
                                    sb_Content.AppendFormat("<td>&nbsp;</td>");
                                }
                                break;
                            default:
                                break;

                        }
                    }
                }
                s = string.Format("{0}{1}{2}", strHead, sb_Content.ToString(), strEnd);
                if (!xHtmlString.Contains(s)) { xHtmlString += s; }
            }
            else
            {
                xHtmlString += "";
            }
            //if (!xHtmlString.Contains(s)) { xHtmlString += s; }
        }
        #endregion

        #region 强拆信息查询Html
        /// <summary>
        /// 强拆信息查询Html
        /// </summary>
        /// <param name="dt"></param>
        protected void CqqcxxHtml(DataTable dt)
        {
            System.Text.StringBuilder sb_Content = new System.Text.StringBuilder();
            string s = string.Empty;
            if (dt.Rows.Count > 0)
            {
                string strHead = @"<br/><table border='1'  cellpadding='0' cellspacing='0' width='95%' class='window_tab_list'>
                <tr><th colspan='3'>强拆信息查询</th></tr>
                <tr>
                <td>案件号</td><td> 强拆日期</td><td> 强拆方式</td>
                </tr>";
                string strEnd = "</table>";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sb_Content.Append("<tr style='height:25px;'>");
                    foreach (DataColumn cl in dt.Columns)
                    {
                        switch (cl.ToString())
                        {
                            case "CASEID":
                            case "sQcfs":
                                sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", dt.Rows[i][cl].ToString());
                                break;
                            case "QCRQ":
                                if (dt.Rows[i][cl].ToString() != "")
                                {
                                    sb_Content.AppendFormat("<td style='font-size: 12px;'>{0}</td>", String.Format("{0:d}", dt.Rows[i][cl]));
                                }
                                else
                                {
                                    sb_Content.AppendFormat("<td>&nbsp;</td>");
                                }
                                break;
                            default:
                                break;

                        }
                    }
                }
                s = string.Format("{0}{1}{2}", strHead, sb_Content.ToString(), strEnd);
                if (!xHtmlString.Contains(s)) { xHtmlString += s; }
            }
            else
            {
                xHtmlString += "";
            }
            //if (!xHtmlString.Contains(s)) { xHtmlString += s; }
        }
        #endregion

        #region 强制执行信息查询
        /// <summary>
        /// 强拆信息查询
        /// </summary>
        protected void databindCqqcxx()
        {
            DataTable dt = new DataTable();
            string caseid = GetCaseID();
            string whereKey = " and caseid = '" + caseid + "'";
            dt = GetCjqcxx(whereKey);
            if (dt.Rows.Count > 0)
            {
                DataColumn dc = new DataColumn("sQcfs");
                dt.Columns.Add(dc);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string sQcfs = returnKeyValue("强制执行方式", dt.Rows[i]["Qcfs"].ToString());
                    dt.Rows[i]["sQcfs"] = sQcfs;
                }
            }
            gridviewQcxx.DataSource = dt;
            gridviewQcxx.RecordCount = dt.Rows.Count;
            gridviewQcxx.DataBind();
            CqqcxxHtml(dt);
            CustomGridView6.DataSource = dt;
            CustomGridView6.RecordCount = dt.Rows.Count;
            CustomGridView6.DataBind();
        }
        #endregion
        #region 司法申请信息查询
        /// <summary>
        /// 司法申请信息查询
        /// </summary>
        protected void databindSfsq()
        {
            DataTable dt = new DataTable();
            string caseid = GetCaseID();
            string whereKey = " and caseid = '" + caseid + "'";
            dt = GetSfsq(whereKey);
            gridviewSfsq.DataSource = dt;
            gridviewSfsq.RecordCount = dt.Rows.Count;
            gridviewSfsq.DataBind();

            CustomGridView7.DataSource = dt;
            CustomGridView7.RecordCount = dt.Rows.Count;
            CustomGridView7.DataBind();
        }
        #endregion

        #region  一审诉讼信息 行创建
        /// <summary>
        /// 一审诉讼信息 行创建
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gridviewYsss_RowCreated(object sender, GridViewRowEventArgs e)
        {
            switch (e.Row.RowType)
            {
                case DataControlRowType.Header:
                    break;
                case DataControlRowType.DataRow:
                    if (e.Row.DataItem == null)
                    {
                        break;
                    }
                    DataRowView drv = e.Row.DataItem as DataRowView;
                    HyperLink hEdit = e.Row.FindControl("hlEdit2") as HyperLink;
                    if (hEdit != null && drv != null)
                    {
                        hEdit.Text = "编辑";
                        hEdit.NavigateUrl = "javascript:OpenEidtWindow('Frist_lawsuit_new.aspx?id=" + drv["id"].ToString() + "','" + drv["caseid"].ToString() + "','3');";//"Changehouse_new.aspx?action=add&caseid=" + drv["caseid"].ToString() + "";
                    }

                    HyperLink hDelete = e.Row.FindControl("hlDel2") as HyperLink;
                    if (hDelete != null && drv != null)
                    {
                        hDelete.Text = "删除";
                        hDelete.NavigateUrl = "javascript:OpenDeleteWindow('ZS_BCJDLRDelete.aspx?iSession=3&id=" + drv["id"].ToString() + "','ZS_ONEJUSTICE');";
                    }
                    break;
            }
        }

        #endregion

        #region 二审诉讼信息 行创建
        /// <summary>
        /// 二审诉讼信息 行创建
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gridviewEsss_RowCreated(object sender, GridViewRowEventArgs e)
        {
            switch (e.Row.RowType)
            {
                case DataControlRowType.Header:
                    break;
                case DataControlRowType.DataRow:
                    if (e.Row.DataItem == null)
                    {
                        break;
                    }
                    DataRowView drv = e.Row.DataItem as DataRowView;
                    HyperLink hEdit = e.Row.FindControl("hlEdit3") as HyperLink;
                    if (hEdit != null && drv != null)
                    {
                        hEdit.Text = "编辑";
                        hEdit.NavigateUrl = "javascript:OpenEidtWindow('Second_lawsuit_new.aspx?id=" + drv["id"].ToString() + "','" + drv["caseid"].ToString() + "','4');";//"Changehouse_new.aspx?action=add&caseid=" + drv["caseid"].ToString() + "";
                    }

                    HyperLink hDelete = e.Row.FindControl("hlDel3") as HyperLink;
                    if (hDelete != null && drv != null)
                    {
                        hDelete.Text = "删除";
                        hDelete.NavigateUrl = "javascript:OpenDeleteWindow('ZS_BCJDLRDelete.aspx?iSession=4&id=" + drv["id"].ToString() + "','ZS_ONEJUSTICE');";
                    }
                    break;
            }
        }
        #endregion

        #region 再审诉讼信息 行创建
        /// <summary>
        /// 再审诉讼信息 行创建
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gridviewZsss_RowCreated(object sender, GridViewRowEventArgs e)
        {
            switch (e.Row.RowType)
            {
                case DataControlRowType.Header:
                    break;
                case DataControlRowType.DataRow:
                    if (e.Row.DataItem == null)
                    {
                        break;
                    }
                    DataRowView drv = e.Row.DataItem as DataRowView;
                    HyperLink hEdit = e.Row.FindControl("hlEdit6") as HyperLink;
                    if (hEdit != null && drv != null)
                    {
                        hEdit.Text = "编辑";
                        hEdit.NavigateUrl = "javascript:OpenEidtWindow('Three_lawsuit_new.aspx?id=" + drv["id"].ToString() + "','" + drv["caseid"].ToString() + "','5');";
                    }

                    HyperLink hDelete = e.Row.FindControl("hlDel6") as HyperLink;
                    if (hDelete != null && drv != null)
                    {
                        hDelete.Text = "删除";
                        hDelete.NavigateUrl = "javascript:OpenDeleteWindow('ZS_BCJDLRDelete.aspx?iSession=5&id=" + drv["id"].ToString() + "','ZS_ONEJUSTICE');";
                    }
                    break;
            }
        }
        #endregion

        #region 抗诉信息 行创建
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gridviewKs_RowCreated(object sender, GridViewRowEventArgs e)
        {
            switch (e.Row.RowType)
            {
                case DataControlRowType.Header:
                    break;
                case DataControlRowType.DataRow:
                    if (e.Row.DataItem == null)
                    {
                        break;
                    }
                    DataRowView drv = e.Row.DataItem as DataRowView;
                    HyperLink hEdit = e.Row.FindControl("hlEdit7") as HyperLink;
                    if (hEdit != null && drv != null)
                    {
                        hEdit.Text = "编辑";
                        hEdit.NavigateUrl = "javascript:OpenEidtWindow('Resist_lawsuit_new.aspx?id=" + drv["id"].ToString() + "','" + drv["caseid"].ToString() + "','6');";
                    }

                    HyperLink hDelete = e.Row.FindControl("hlDel7") as HyperLink;
                    if (hDelete != null && drv != null)
                    {
                        hDelete.Text = "删除";
                        hDelete.NavigateUrl = "javascript:OpenDeleteWindow('ZS_BCJDLRDelete.aspx?iSession=6&id=" + drv["id"].ToString() + "','ZS_ONEJUSTICE');";
                    }
                    break;
            }
        }
        #endregion

        #region 行政复议 行创建
        /// <summary>
        /// 行政复议 行创建
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gridviewxzfy_RowCreated(object sender, GridViewRowEventArgs e)
        {
            switch (e.Row.RowType)
            {
                case DataControlRowType.Header:
                    break;
                case DataControlRowType.DataRow:
                    if (e.Row.DataItem == null)
                    {
                        break;
                    }
                    DataRowView drv = e.Row.DataItem as DataRowView;
                    HyperLink hEdit = e.Row.FindControl("hlEdit4") as HyperLink;
                    if (hEdit != null && drv != null)
                    {
                        hEdit.Text = "编辑";
                        hEdit.NavigateUrl = "javascript:OpenEidtWindow('Admin_cont_new.aspx?id=" + drv["id"].ToString() + "','" + drv["caseid"].ToString() + "','2');";//"Changehouse_new.aspx?action=add&caseid=" + drv["caseid"].ToString() + "";
                    }

                    HyperLink hDelete = e.Row.FindControl("hlDel4") as HyperLink;
                    if (hDelete != null && drv != null)
                    {
                        hDelete.Text = "删除";//
                        hDelete.NavigateUrl = "javascript:OpenDeleteWindow('ZS_BCJDLRDelete.aspx?iSession=2&id=" + drv["id"].ToString() + "','ZS_BCJDXZFY');";
                    }
                    break;
            }

        }
        #endregion

        #region 行政强拆 行创建
        /// <summary>
        /// 行政强拆 行创建
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gridviewQcxx_RowCreated(object sender, GridViewRowEventArgs e)
        {
            switch (e.Row.RowType)
            {
                case DataControlRowType.Header:
                    break;
                case DataControlRowType.DataRow:
                    if (e.Row.DataItem == null)
                    {
                        break;
                    }
                    DataRowView drv = e.Row.DataItem as DataRowView;
                    HyperLink hEdit = e.Row.FindControl("hlEdit5") as HyperLink;
                    if (hEdit != null && drv != null)
                    {
                        hEdit.Text = "编辑";
                        hEdit.NavigateUrl = "javascript:OpenEidtWindow('Force_new.aspx?id=" + drv["id"].ToString() + "','" + drv["caseid"].ToString() + "','7');";//"Changehouse_new.aspx?action=add&caseid=" + drv["caseid"].ToString() + "";
                    }

                    HyperLink hDelete = e.Row.FindControl("hlDel5") as HyperLink;
                    if (hDelete != null && drv != null)
                    {
                        hDelete.Text = "删除";
                        hDelete.NavigateUrl = "javascript:OpenDeleteWindow('ZS_BCJDLRDelete.aspx?iSession=7&id=" + drv["id"].ToString() + "','ZS_QZZXXX');";
                    }
                    break;
            }
        }
        #endregion

        #region 司法申请 行创建
        /// <summary>
        /// 司法申请 行创建
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gridviewSfsq_RowCreated(object sender, GridViewRowEventArgs e)
        {
            switch (e.Row.RowType)
            {
                case DataControlRowType.Header:
                    break;
                case DataControlRowType.DataRow:
                    if (e.Row.DataItem == null)
                    {
                        break;
                    }
                    DataRowView drv = e.Row.DataItem as DataRowView;
                    HyperLink hEdit = e.Row.FindControl("hlEdit8") as HyperLink;
                    if (hEdit != null && drv != null)
                    {
                        hEdit.Text = "编辑";
                        hEdit.NavigateUrl = "javascript:OpenEidtWindow('ZS_SFSQ.aspx?id=" + drv["id"].ToString() + "','" + drv["caseid"].ToString() + "','7');";//"Changehouse_new.aspx?action=add&caseid=" + drv["caseid"].ToString() + "";
                    }

                    HyperLink hDelete = e.Row.FindControl("hlDel8") as HyperLink;
                    if (hDelete != null && drv != null)
                    {
                        hDelete.Text = "删除";
                        hDelete.NavigateUrl = "javascript:OpenDeleteWindow('ZS_BCJDLRDelete.aspx?iSession=8&id=" + drv["id"].ToString() + "','ZS_SFSQXX');";
                    }
                    break;
            }
        }
        #endregion

        #region 结转数据保存
        /// <summary>
        /// 结转数据保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSaveZjTime_Click(object sender, EventArgs e)
        {
            string caseid = GetCaseID();
            string zjTime = calZjTime.Text;
            ClientScriptManager csm = Page.ClientScript;
            try
            {
                if (zjTime == "")
                {
                    DeleteZjTime(caseid);
                }
                else if (zjTime.Length == 4)
                {
                    zjTime = zjTime + "-01-01";
                    SaveZjTime(Convert.ToDateTime(zjTime), caseid);
                }
                else
                {
                    SaveZjTime(Convert.ToDateTime(zjTime), caseid);
                }
                base.Page.Session["nCount"] = "1";
                csm.RegisterStartupScript(this.GetType(), "scriptBasic1", "<script>window.location.href = window.location.href;</script>");
            }
            catch
            {
                csm.RegisterStartupScript(this.GetType(), "scriptBasic2", "<script>保存失败，请联系管理员，共同解决！</script>");
            }
        }
        #endregion
        #region 附件上传
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            string strid = base.Page.Request["ID"];
            if (!string.IsNullOrEmpty(strid))
            {
                string strScript = string.Format("<script>OpenFileUpload('{0}','{1}','{2}');</script>",
                strid, strid, strid);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "opennew", strScript);
            }
        }
        #endregion
        #region 数据字典中取KeyValue
        protected String returnKeyValue(string nName, string nCode)
        {
            if (!string.IsNullOrEmpty(nCode) && !string.IsNullOrEmpty(nName))
            {
                string szqKeyValue = GetSysparamsInfo(nName, nCode);
                return szqKeyValue;
            }
            else
            {
                return string.Empty;
            }
        }

        #endregion

        #region 返回案件号
        protected String GetCaseID()
        {
            if (!string.IsNullOrEmpty(idadmin))
            {
                string caseid = GetCqcjCaseID(idadmin);
                return caseid;
            }
            else
            {
                return string.Empty;
            }
        }
        #endregion

        #region 类
        public DataTable GetCqcj_houseexchange(string whereValue)
        {
            DataTable dtTemp = GetBasicInfo("cqcj_houseexchange", whereValue);
            return dtTemp;
        }//产权房屋查询
        public DataTable GetCjratify(string whereValue)
        {
            DataTable dtTemp = GetBasicInfo("CQCJ_CJRATIFY", whereValue);
            return dtTemp;
        }//房屋拆迁裁决审批表

        public DataTable GetCjxzfy(string whereValue)
        {
            whereValue += " order by fyh desc";
            string whereKey = "wyNewPackage.GetItemTypeName('复议状态', fyzt) sFyzt, ";
            DataTable dtTemp = GetBasicInfo("ZS_BCJDXZFY", whereKey, whereValue);
            return dtTemp;
        }//行政复议
        public DataTable GetCqcjOneJustice(string whereValue)
        {
            whereValue += " and flag = 1";
            string sSszt = " wynewpackage.GetItemTypeName('诉讼状态',sszt) sSszt ,";
            DataTable dtTemp = GetBasicInfo("ZS_ONEJUSTICE", sSszt, whereValue);
            return dtTemp;
        }// 一审诉讼信息查询
        public DataTable GetCqcjTwoJustice(string whereValue)
        {
            whereValue += " and flag = 2";
            string sSszt = " wynewpackage.GetItemTypeName('诉讼状态',sszt) sSszt ,";
            DataTable dtTemp = GetBasicInfo("ZS_ONEJUSTICE", sSszt, whereValue);
            return dtTemp;
        }// 二审诉讼信息查询
        public DataTable GetCqcjThreeJustice(string whereValue)
        {
            whereValue += " and flag = 3";
            DataTable dtTemp = GetBasicInfo("ZS_ONEJUSTICE", whereValue);
            return dtTemp;
        }//再审诉讼信息查询
        public DataTable GetCqcjResistJustice(string whereValue)
        {
            whereValue += " and flag = 4";
            DataTable dtTemp = GetBasicInfo("ZS_ONEJUSTICE", whereValue);
            return dtTemp;
        }//抗诉信息查询

        public DataTable GetCjqcxx(string whereValue)
        {
            DataTable dtTemp = GetBasicInfo("ZS_QZZXXX", whereValue);
            return dtTemp;
        }//强拆信息查询
        public DataTable GetSfsq(string whereValue)
        {
            DataTable dtTemp = GetBasicInfo("ZS_SFSQXX", whereValue);
            return dtTemp;
        }//司法申请信息查询


        /// <summary>
        /// 结转数据保存
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="caseid"></param>
        public void SaveZjTime(DateTime dt, string caseid)
        {
            _EluZSDataProvider.UpdateSomething("ZS_CASE_REGISTER", "jzsj", "to_date('" + dt.ToShortDateString() + "','yyyy-MM-dd')", "caseid", caseid);
        }
        public void DeleteZjTime(string caseid)
        {
            if (!string.IsNullOrEmpty(caseid))
            {
                _EluZSDataProvider.UpdateSomething("ZS_CASE_REGISTER", "jzsj", "", "caseid", caseid);
            }
        }
        /// <summary>
        /// 取数据字典中单条的keyname
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="nCode"></param>
        /// <returns></returns>
        public String GetSysparamsInfo(string Name, string nCode)
        {
            string nKeyvalue = string.Empty;
            if (!string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(nCode))
            {
                nKeyvalue = _EluZSDataProvider.GetParamsOne(Name, nCode);
            }
            return nKeyvalue;
        }
        /// <summary>
        /// 获取数据集
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="whereValue"></param>
        /// <returns></returns>
        protected DataTable GetBasicInfo(string tableName, string whereValue)
        {
            return _EluZSDataProvider.GetSFBasicInfo(tableName,"", whereValue);
        }
        protected DataTable GetBasicInfo(string tableName, string selectKey, string whereValue)
        {
            return _EluZSDataProvider.GetSFBasicInfo(tableName, selectKey, whereValue);
        }
        /// <summary>
        /// 获取案件号
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetCqcjCaseID(string id)
        {
            string sCaseid = string.Empty;
            sCaseid = _EluZSDataProvider.GetSomeStr("ZS_CASE_REGISTER", "caseid", "id", id);
            return sCaseid;
        }
        /// <summary>
        /// 获取拆迁裁决信息
        /// </summary>
        /// <param name="whereValue"></param>
        /// <returns></returns>
        public DataTable GetCqcjInfo(string whereValue)
        {
            DataTable dtTemp =  _EluZSDataProvider.GetCaseSF(whereValue);
            return dtTemp;
        }
        #endregion 
    }
}


